import { createRouter, createWebHistory } from 'vue-router'
import LayoutView from '@/views/LayoutView.vue'

// 一级路由
const TestView = import('@/views/TestView.vue')
const LoginView = import('@/views/LoginView.vue')

// 二级路由
const HomeView = import('@/views/school/HomeView.vue')
const CrpModuleView = import('@/views/school/CrpModuleView.vue')
const CrpItemView = import('@/views/school/CrpItemView.vue')
const ClassView = import('@/views/school/ClassView.vue')
const StudentView = import('@/views/school/StudentView.vue')
const DepartmentView = import('@/views/school/DepartmentView.vue')

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: LayoutView,
      children: [
        {
          path: '/school/home',
          name: 'schoolHome',
          component: () => HomeView,
        },
        {
          path: '/school/crp-module',
          name: 'schoolCrpModule',
          component: () => CrpModuleView,
        },
        {
          path: '/school/crp-item',
          name: 'schoolCrpItem',
          component: () => CrpItemView,
        },
        {
          path: '/school/class',
          name: 'schoolClass',
          component: () => ClassView,
        },
        {
          path: '/school/student',
          name: 'schoolStudent',
          component: () => StudentView,
        },
        {
          path: '/school/department',
          name: 'schoolDepartment',
          component: () => DepartmentView,
        },
        {
          path: '/school/crp',
          name: 'schoolCrp',
          component: () => import('@/views/school/CrpView.vue'),
        },
        // 班级管理员
        {
          path: '/class/student',
          name: 'classStudent',
          component: () => import('@/views/clazz/StudentView1.vue'),
        },
        {
          path: '/class/crp',
          name: 'classCrp',
          component: () => import('@/views/clazz/CrpView1.vue'),
        },
        // 部门管理员
        {
          path: '/department/home',
          name: 'departmentHome',
          component: () => import('@/views/department/HomeView.vue'),
        },
        {
          path: '/department/activity',
          name: 'departmentActivity',
          component: () => import('@/views/department/ActivityView.vue'),
        },
        {
          path: '/department/depstu',
          name: 'departmentDepstu',
          component: () => import('@/views/department/DepStuView.vue'),
        },
      ],
    },
    {
      path: '/test',
      name: 'test',
      component: () => TestView,
    },
    {
      path: '/login',
      name: 'login',
      component: () => LoginView,
    },
  ],
})

export default router
